/**
 * @ProjectName:exam
 * @FileName: DriverEntity.java
 * @PackageName: edu.xpu.project.user.entity
 * @Company:北京有生博大软件有限公司（西安分公司）
 * @Copyright (c) 2017,RiseSoft  All Rights Reserved.
 * @date 2017年4月29日 上午8:51:14
 */
package edu.xpu.project.user.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import edu.xpu.project.log.entity.DriverLog;
import edu.xpu.project.vehicle.entity.SchoolBus;

/**
 * @ClassName: DriverEntity.java
 * @Description: 驾驶员实体
 *
 * @author liukang
 * @date 2017年4月29日 上午8:51:14
 * @version 
 * @since JDK 1.6
 */
@Entity(name="DriverEntity")
@Table(name="DRIVER")
public class DriverEntity implements Serializable {
	private static final long serialVersionUID = 6474794894621222122L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id; 

	private String name;				//姓名
	private String loginName;			//登录名
	private String pwd;					//密码
	private String sex;					//性别
	
	private Date birthDay;				//生日
	
	private String telPhone;			//手机号
	
	private Integer drivingExp;			//驾龄
	
	//驾驶员和校车一对一关系
	@OneToMany(mappedBy="driverEntity")
	private Set<SchoolBus> schoolBuses;
	
	
	/*--------------- 系统属性 -----------------*/
	private Date createDate;
	private Long createPersonId;
	private String createPersonName;
	
	@OneToMany(mappedBy="driverEntity", fetch=FetchType.EAGER)
	private Set<DriverLog> driverLogs;
	
	public int getDriverLogNum() {
		if (driverLogs != null) {
			return driverLogs.size();
		}
		return 0;
	}
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getLoginName() {
		return loginName;
	}
	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}
	public String getPwd() {
		return pwd;
	}
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public Date getBirthDay() {
		return birthDay;
	}
	public void setBirthDay(Date birthDay) {
		this.birthDay = birthDay;
	}
	public String getTelPhone() {
		return telPhone;
	}
	public void setTelPhone(String telPhone) {
		this.telPhone = telPhone;
	}
	public Integer getDrivingExp() {
		return drivingExp;
	}
	public void setDrivingExp(Integer drivingExp) {
		this.drivingExp = drivingExp;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public Long getCreatePersonId() {
		return createPersonId;
	}
	public void setCreatePersonId(Long createPersonId) {
		this.createPersonId = createPersonId;
	}
	public String getCreatePersonName() {
		return createPersonName;
	}
	public void setCreatePersonName(String createPersonName) {
		this.createPersonName = createPersonName;
	}
	public Set<SchoolBus> getSchoolBuses() {
		return schoolBuses;
	}
	public void setSchoolBuses(Set<SchoolBus> schoolBuses) {
		this.schoolBuses = schoolBuses;
	}
	public Set<DriverLog> getDriverLogs() {
		return driverLogs;
	}
	public void setDriverLogs(Set<DriverLog> driverLogs) {
		this.driverLogs = driverLogs;
	}
	
}

